function video_name(option) {
    if(!option){
        throw new Error('没有传参数');
    }
    if(!option.sourceUrl || option.sourceUrl == ''){
        throw new Error('没有视频');
    }
    var post = "";
    if(!option.poster || option.poster == ''){
        console.log("没有海报")
    }else {
        post = '<img id="poster" src="'+option.poster+'" alt="">';
    }

    var inner = post + '<video id="videoLive" preload="auto" poster=""  x5-video-player-type="h5" x5-video-player-fullscreen="true" webkit-playsinline="true" x-webkit-airplay="true" playsinline="true" style="width: 100%;height: 100%;">' +
        '<source src="'+option.sourceUrl+'">'+ '</video>' +
        '<div class="backGroundColor partBottom">' +
        '<div class="part-box">' +
        '<div class="partSuspended">' +
        '<div class="display-table">' +
        '<div class="display-table-cellM" style="text-align: center;">' +
        '<div id="suspended" style="display: none;">' +
        '<div class="partSuspended-vertical" style="margin-right: 3px;"></div>' +
        '<div class="partSuspended-vertical"></div>' +
        '</div>' +
        '<div id="playAgain">' +
        '<div style="width: 13px;margin-top: 6px;height: 0;border-left: 12px solid #ffffff;border-top: 7px solid transparent; border-bottom: 7px solid transparent;display: inline-block;"></div>' +
        '</div></div></div></div>' +
        '<div class="partBar">'+
        '<div class="part-box">' +
        '<div class="partBar-timeStart">' +
        '<div class="display-table">' +
        '<div class="display-table-cellM">' +
        '<div style="padding-top: 10px;">' +
        '<p class="partBar-time-text"><span id="videoNowTime">00:00:00</span></p>' +
        '</div></div></div></div>' +
        '<div class="partBar-bar" id="partBar">' +
        '<div class="display-table">' +
        '<div class="display-table-cellM">' +
        '<div style="padding-top: 10px;">' +
        '<div id="bar">' +
        '<div id="barBefore"></div>' +
        '<div id="barAfter">' +
        '<div class="display-table">' +
        '<div class="display-table-cellM">' +
        '<div class="barAfter"></div>' +
        '</div></div></div>' +
        '</div>' +
        '</div></div></div></div>' +
        '<div class="partBar-timeEnd">' +
        '<div class="display-table">' +
        '<div class="display-table-cellM">' +
        '<div style="padding-top: 10px;">' +
        '<p class="partBar-time-text"><span id="videoDuration"></span></p>' +
        '</div></div></div></div></div>' +
        '</div></div></div>' ;
    option.container.append(inner);

    option.container.css('position','relative');
    var video = document.getElementById('videoLive');
    var hasoncanplay = false;
//        获取视频结束时间
//     video.oncanplay = function(){
//         if(hasoncanplay){
//             return;
//         }
//         hasoncanplay = true;
//         var allTime = formatSeconds(video.duration);
//         console.log($('#videoLive'));
//         autoWH();
//         $('#videoDuration').text(allTime);
//         if(option.onready){
//             option.onready();
//         }
//         if(option.autoplay===true){
//             video.play();
//         }
//         // barInterval = setInterval(setCurrentTime,200);
//     };
    video.addEventListener('canplay',function () {
        if(hasoncanplay){
            return;
        }
        hasoncanplay = true;
        var allTime = formatSeconds(video.duration);
        console.log($('#videoLive'));
        autoWH();
        $('#videoDuration').text(allTime);
        if(option.onready){
            option.onready();
        }
        if(option.autoplay===true){
            video.play();
        }
        // barInterval = setInterval(setCurrentTime,200);

    },false);


    //定时器
    var barInterval;


    //获取播放时间
    function setCurrentTime() {
        var curt =  video.currentTime;
        var runTime = formatSeconds(curt);
        var percent = video.currentTime / video.duration;
        $('#barAfter').css('left', percent*100+'%');
        $('#barBefore').css('width', percent*100+'%');
        $('#videoNowTime').text(runTime);
    }

    // video.onplay = function(){
    //     // video.currentTime = 0;//设定开始时间
    //     barInterval = setInterval(setCurrentTime,200);
    // };
    video.addEventListener('play',function () {
        $('#playAgain').css('display','none');
        $('#suspended').css('display','block');
        // video.currentTime = 0;//设定开始时间
        barInterval = setInterval(setCurrentTime,200);
    },false);
    //播放结束
    video.addEventListener('ended', function () {
        clearInterval(barInterval);
        if(option.onend){
            option.onend();
        }
        $('#playAgain').css('display','block');
        $('#suspended').css('display','none');
    }, false);
    //播放暂停
    video.addEventListener('pause', function () {
        $('#playAgain').css('display','block');
        $('#suspended').css('display','none');
//            alert("暂停");
    }, false);

    //时间转换
    function formatSeconds(value) {
        var theTime = parseInt(value);// 秒
        var theTime1 = 0;// 分
        var theTime2 = 0;// 小时
        // alert(theTime);
        if(theTime > 60) {
            theTime1 = parseInt(theTime/60);
            theTime = parseInt(theTime%60);
            // alert(theTime1+"-"+theTime);
            if(theTime1 > 60) {
                theTime2 = parseInt(theTime1/60);
                theTime1 = parseInt(theTime1%60);
            }
        }
        var result = "";
        if(theTime>=10){
            result = parseInt(theTime);
        }else if(theTime>=0){
            result = "0"+parseInt(theTime);
        }
        if(theTime1 >= 10 ) {
            result = ""+parseInt(theTime1)+":"+result;
        }else if(theTime1 >= 0){
            result = "0"+parseInt(theTime1)+":"+result;
        }
        if(theTime2 >= 10) {
            result = ""+parseInt(theTime2)+":"+result;
        }else if(theTime2 >= 0){
            result = "0"+parseInt(theTime2)+":"+result;
        }
        return result;
    }

    //获取视频盒子
    var oVideoBox = document.getElementById("videoBox");
//获取滚动盒子
    var oScrollBox = document.getElementById("scrollBox");

    //内容块滑动插件
    var fScroll=new iScroll(oScrollBox, {hScrollbar: false, vScrollbar: false,bounce:false});
    window.addEventListener('touchmove', function (e) {
        e.preventDefault();
    }, false);

    var iWindowWidth;
    var iWindowHeight;
    //获取视频宽和高
    function autoWH() {
        //获取可视区宽度
        iWindowWidth = window.innerWidth;
        //获取可视区高度
        iWindowHeight = window.innerHeight;
        var iScrollH = 368 * iWindowWidth / 640;
        oScrollBox.style.top = iScrollH + "px";
        oScrollBox.style.height = iWindowHeight - iScrollH + "px";
        oVideoBox.style.height = iScrollH + 'px';
        fScroll.refresh();
    }
    autoWH();

    window.onresize = function () {
        autoWH();
        video.style.width = iWindowWidth + "px";
        video.style.height = iWindowHeight + "px";
    };
    //点击暂停按钮
    $('#suspended').click(function () {
       $('#playAgain').css('display','block');
        $('#suspended').css('display','none');
        video.pause();
    });
    //播放
    $('#playAgain').click(function () {
        $('#suspended').css('display','block');
        $('#playAgain').css('display','none');
        video.play();
    });

    //进度条拖拽
    // $('#barAfter').touchStart(function () {
    //     if($('#barAfter').css('left') > '0px'){
    //         var barLeft = $('#barAfter').css(left);
    //
    //         console.log($('#barAfter').css('left'));
    //     }
    // });
    // var touch = true;
    // document.getElementById('barAfter').addEventListener('touchstart',function (e) {
    //     var startx = e.touches[0].pageX;
    //    console.log(startx);
    // },false);
    // document.getElementById('barAfter').addEventListener('touchend',function (e) {
    //     var endx = e.changedTouches[0].pageX;
    //     console.log('end',endx);
    // },false);
    var touch=false;
    var tx,x;
    var barLenght = $('#partBar').width();
    console.log(barLenght);
    $(function(){
        document.getElementById("barAfter").addEventListener('touchend',function(){
             // video.currentTime = (n/barLenght) * video
            // barInterval = setInterval(setCurrentTime,200);
            video.play();
            touch = false;
        });
        document.getElementById("barAfter").addEventListener('touchstart',selectmouse);
        document.getElementById("barAfter").addEventListener('touchmove',movemouse);
    });
    function movemouse(e){
        if (touch){
            // var n = tx + e.touches[0].pageX - x;
            var n = e.touches[0].pageX - tx;
            if(n >= 0 && n < barLenght){
                $("#barAfter").css("left",n);
                $('#barBefore').css('width',n);
                // console.log(n);
                // console.log('parent',(n/barLenght) * 100 + '%');
                video.currentTime = (n/barLenght) * video.duration;

                return false;
            }else if(n < 0){
                n = 0;
                $("#barAfter").css("left",n);
                $('#barBefore').css('width',n);
                // console.log(n);
                return false;
            }else {
                n = barLenght;
                $("#barAfter").css("left",n);
                $('#barBefore').css('width',n);
                return false;
            }
        }
    }

    function selectmouse(e){
        touch = true;
        // clearInterval(barInterval);
        var barAfterLeft = $("#barAfter").css("left");
        console.log(barAfterLeft);
        tx = 90;
        video.pause();
        x = e.touches[0].pageX;
        console.log(e.touches[0]);
        return false;
    }

//=========================================================================
    var player = new Object();

    if(!option.logo || option.logo == ''){
        console.log('没有logo')
    }else{
        var logoing = '<div class="partLogo">' +
            '<img src="'+ option.logo +'" alt="" style="width: 100%;height: 100%;"></div>' ;
//            alert(1);
        option.container.append(logoing);
    }

    if(!option.advertising || option.advertising == ''){
        console.log('没有广告')
    }else{
        var adt = '<div id="advertising" class="partAdvertising">' +
            '<img src="'+ option.advertising + '" alt="" style="width: 100%;height: 100%;"></div>';
//            alert(1);
        option.container.append(adt);
    }

    player.play = function(){
        $('#poster').css('display','none');
        video.play();
        alert("播放");
    };
    player.ended = function () {
        clearInterval(barInterval);
    };

    document.getElementById('videoLive').addEventListener('play', function () {
        $('#poster').css('display','none');
//            alert("播放");
    }, false);

    player.poster = function(poster){
        if(poster){
            $('#poster').attr("src",poster);
        }else{
            return $('#poster').attr("src");
        }
    };
    return player;
}